package com.yowasa.xiuxian.engine.battle.enemy.strategy;

import com.google.common.collect.Lists;
import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.engine.battle.strategy.BaseSpellStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@BS(name = "特瓦林")
@Order(1006)
@Component
public class TeWaLin extends BaseSpellStrategy {
    @Autowired
    private BattleHelper battleHelper;

    @Override
    public ElementEnum getElement() {
        return null;
    }

    @Override
    public void action(UserBattleContent first, UserBattleContent second, BattleContent content) {
        int dmg;
        String desc;
        int i = RandomUtil.randomInt(1);
        if (i == 0) {
            int orgAtk = first.getBattleInfo().getAtk();
            int def = second.getBattleInfo().getDef();
            int atk = (int) (orgAtk * 1.2);
            dmg = battleHelper.calAtk(atk, def);
            desc = RandomUtil.choice(Lists.newArrayList("爪击","撕咬"));
        } else {
            int orgAtk = first.getBattleInfo().getSpell();
            int def = second.getBattleInfo().getRes();
            double random = Math.random() + 0.6;
            int atk = (int) (orgAtk * random);
            dmg = battleHelper.calSpell(atk, def);
            desc = RandomUtil.choice(Lists.newArrayList("风龙吐息","魔弹射击","风元素射击","高天风弹","终天闭幕曲"));
        }
        battleHelper.autoAction(this, first, second, content, dmg, desc);
    }

    @Override
    public void limit(UserBO user) {
        throw new HandlerException("无法学习妖兽的攻击手段");
    }

    @Override
    public String limitDesc() {
        return "无";
    }

    @Override
    public String desc() {
        return "蒙德的「四风守护」之一，东风之龙特瓦林。\n" +
                "在漫长的岁月与无边的黑暗中，清澈的宝石也会蒙尘而变得黯淡，高傲的龙也会被侵蚀而充满了忿恨。\n" +
                "不过，要记住，尘埃能被轻易拭去，疑惧与毒也能被粉碎。\n\n"+
                "会使用强大的法术攻击 \n" +
                "物理 ：爪击,撕咬\n" +
                "法术 ：风龙吐息,魔弹射击,风元素射击，高天风弹，终天闭幕曲\n\n" +
                "掉落物：\n" +
                "东风之翎，东风之爪，东风的吐息，终天闭幕曲秘籍";
    }


}
